﻿using System;
using RootMotion.FinalIK;
using UnityEngine;

namespace RootMotion.Demos
{
	// Token: 0x020000A6 RID: 166
	public class HoldingHands : MonoBehaviour
	{
		// Token: 0x06000578 RID: 1400 RVA: 0x00035660 File Offset: 0x00033860
		public void Start()
		{
			this.rightHandRotation = Quaternion.Inverse(this.rightHandChar.solver.rightHandEffector.bone.rotation) * base.transform.rotation;
			this.leftHandRotation = Quaternion.Inverse(this.leftHandChar.solver.leftHandEffector.bone.rotation) * base.transform.rotation;
		}

		// Token: 0x06000579 RID: 1401 RVA: 0x000356D8 File Offset: 0x000338D8
		public void LateUpdate()
		{
			Vector3 b = Vector3.Lerp(this.rightHandChar.solver.rightHandEffector.bone.position, this.leftHandChar.solver.leftHandEffector.bone.position, this.crossFade);
			base.transform.position = Vector3.Lerp(base.transform.position, b, Time.deltaTime * this.speed);
			base.transform.rotation = Quaternion.Slerp(this.rightHandChar.solver.rightHandEffector.bone.rotation * this.rightHandRotation, this.leftHandChar.solver.leftHandEffector.bone.rotation * this.leftHandRotation, this.crossFade);
			this.rightHandChar.solver.rightHandEffector.position = this.rightHandTarget.position;
			this.rightHandChar.solver.rightHandEffector.rotation = this.rightHandTarget.rotation;
			this.leftHandChar.solver.leftHandEffector.position = this.leftHandTarget.position;
			this.leftHandChar.solver.leftHandEffector.rotation = this.leftHandTarget.rotation;
		}

		// Token: 0x04000464 RID: 1124
		public FullBodyBipedIK rightHandChar;

		// Token: 0x04000465 RID: 1125
		public FullBodyBipedIK leftHandChar;

		// Token: 0x04000466 RID: 1126
		public Transform rightHandTarget;

		// Token: 0x04000467 RID: 1127
		public Transform leftHandTarget;

		// Token: 0x04000468 RID: 1128
		public float crossFade;

		// Token: 0x04000469 RID: 1129
		public float speed = 10f;

		// Token: 0x0400046A RID: 1130
		public Quaternion rightHandRotation;

		// Token: 0x0400046B RID: 1131
		public Quaternion leftHandRotation;
	}
}
